//
//  FinancialDetailsTableViewCell.m
//  LotteryProject
//
//  Created by 阳光 on 17/7/9.
//  Copyright © 2017年 阳光. All rights reserved.
//

#import "FinancialDetailsTableViewCell.h"

@interface FinancialDetailsTableViewCell ()

// 图片
@property(nonatomic,strong)UIImageView *imageUrl;

// 日期
@property(nonatomic,strong)UILabel *nameLabel;

// 时间
@property(nonatomic,strong)UILabel *timeLabel;

// 资金数量
@property(nonatomic,strong)UILabel *numberLabel;

// 状态
@property(nonatomic,strong)UILabel *stateLabel;

// 箭头
@property(nonatomic,strong)UIImageView *arrowIcon;

@end

@implementation FinancialDetailsTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        // ➡️Cell类型
        self.accessoryType=UITableViewCellAccessoryNone;

        self.arrowIcon.hidden=NO;

        self.nameLabel.font=FontNumber(18);

        self.timeLabel.font=FontNumber(16);

        self.numberLabel.font=FontNumber(16);

        self.stateLabel.font=FontNumber(16);

        self.backgroundColor=WhiteColor;
    }
    return self;
}

-(UIImageView *)imageUrl
{
    if (!_imageUrl) {
        _imageUrl=[UIImageView new];
        _imageUrl.backgroundColor=MainColor;
        [self.contentView addSubview:self.imageUrl];
        ViewBorderRadius(_imageUrl,kmargin*5/2,1,ClearColor);
        [_imageUrl mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(APPW/2);
            make.size.mas_equalTo(CGSizeMake(kmargin*5,kmargin*5));
            make.centerY.mas_equalTo(0);
        }];
    }
    return _imageUrl;
}

// nameLabel
- (UILabel *)nameLabel
{

    if (!_nameLabel) {
        _nameLabel=[self getLabelWithText:@"今天" font:FontNumber(18) textColor:DarkGreyColor textAlignment:NSTextAlignmentLeft lineBreakMode:NSLineBreakByCharWrapping numberOfLines:1];
        [self.contentView addSubview:_nameLabel];
        [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.top.mas_equalTo(kmargin*2);
        }];
    }
    return _nameLabel;
}

// timeLabel
- (UILabel *)timeLabel
{
    if (!_timeLabel) {
        _timeLabel=[self getLabelWithText:@"16:59:59" font:FontNumber(16) textColor:LightGreyColor textAlignment:NSTextAlignmentLeft lineBreakMode:NSLineBreakByTruncatingTail numberOfLines:1];
        [self.contentView addSubview:_timeLabel];
        [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.nameLabel.mas_bottom).offset(kmargin);
            make.left.mas_equalTo(self.nameLabel.mas_left);
            make.width.mas_equalTo(APPW/4);
        }];
    }
    return _timeLabel;
}

- (UILabel *)numberLabel
{
    if (!_numberLabel) {
        _numberLabel=[self getLabelWithText:@"-4.00" font:FontNumber(16) textColor:LightGreyColor textAlignment:NSTextAlignmentLeft lineBreakMode:NSLineBreakByTruncatingTail numberOfLines:1];
        [self.contentView addSubview:_numberLabel];
        [_numberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.nameLabel.mas_top);
            make.right.mas_equalTo(-kmargin*2);
        }];
    }
    return _numberLabel;
}

- (UILabel *)stateLabel
{
    if (!_stateLabel) {
        _stateLabel=[self getLabelWithText:@"待处理" font:FontNumber(16) textColor:LightGreyColor textAlignment:NSTextAlignmentLeft lineBreakMode:NSLineBreakByTruncatingTail numberOfLines:1];
        [self.contentView addSubview:_stateLabel];
        [_stateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.timeLabel.mas_top);
            make.right.mas_equalTo(-kmargin*2);
        }];
    }
    return _stateLabel;
}

@end
